Example Program
Hirschbergs Algorithm
Hirschberg with Gotoh alignment code example
This code example illustrates a graph-based Gotoh alignment in linear space (Hirschberg)
1#include <seqan/graph_align.h>
2#include <iostream>
3
4using namespace seqan;
5
6int main() {
7    typedef String<char> TString;
8    typedef StringSet<TString, Dependent<> > TStringSet;
9    typedef Graph<Alignment<TStringSet, void> > TGraph;
Alignments are carried out on a StringSet that holds the sequences
10    TStringSet str;
11    TString str0("TarfieldandGarfieldarestupid.");appendValue(str, str0);
12    TString str1("Garfield");appendValue(str, str1);
Configuration of alignment algorithm: Scoring (Match = 2, Mismatch = -1, Gap-extension = -1, Gap-opening = -4)
13    Score<int> score_type = Score<int>(2,-1,-1,-4);
Out-parameter: An alignment graph
14    TGraph g(str);
Global alignment with Gotoh in linear space (Hirschberg)
15    int score = globalAlignment(g, score_type, Hirschberg());
Console output
16    std::cout << "Scoring schema: Match=2, Mismatch=-1, Gap-extension=-1, Gap-opening=-4" << std::endl;
17    std::cout << g << std::endl;
18    std::cout << "Score: " << score << std::endl;
19    return 0;
20}
SeqAn - Sequence Analysis Library - www.seqan.de